﻿namespace RialternativeSample.Tests.Server.Northwind.Infrastructure
{
    using System.Linq;
    using Rialternative.DomainService;

    public static class RepositoryDomainServiceExtensions
    {
        public static IQueryable<TEntity> GetQuery<TEntity>(this RepositoryDomainService service) where TEntity : class
        {
            return service.Repository.GetQuery<TEntity>();
        }

        public static void Insert<TEntity>(this RepositoryDomainService service, TEntity entity) where TEntity : class
        {
            service.Repository.Insert<TEntity>(entity);
        }

        public static void Delete<TEntity>(this RepositoryDomainService service, TEntity entity) where TEntity : class
        {
            service.Repository.Delete<TEntity>(entity);
        }

        public static void Update<TEntity>(this RepositoryDomainService service, TEntity entity, TEntity originalEntity) where TEntity : class
        {
            service.Repository.Update<TEntity>(entity, originalEntity);
        }
    }
}
